#include<iostream>
using namespace std;
typedef long long LL;
LL gcd(LL a, int b)
{
	return b ? gcd(a, a % b) : b;
}
int main()
{
	LL a, b, n;
	cin >> a >> b >> n;
	LL ans = 0;
	ans = gcd(a, b);
	cout << ans << endl;
	return 0;
}